<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function fun (){
				var r = Math.floor(Math.random() * 256)
				var g = Math.floor(Math.random() * 256)
				var b = Math.floor(Math.random() * 256)
				var color = `rgb(${r},${g},${b})`
				document.body.setAttribute("style",`background-color:${color}`)
				document.querySelector("span").innerHTML = color
			}
		</script>
	</head>
	<body>
		<button type="button" onclick="fun()">随机颜色</button>
		<span>rgb(255,255,255)</span>
	</body>
</html>
